package priv.dajie.tzzq.test;

import org.apache.http.client.methods.HttpGet;
import org.junit.jupiter.api.Test;
import priv.dajie.tzzq.Base;
import priv.dajie.tzzq.proxy.GetProxyException;
import priv.dajie.tzzq.proxy.Proxy;
import priv.dajie.tzzq.proxy.ProxyPoolXs;
import priv.dajie.tzzq.proxy.ProxyType;

import java.util.HashSet;

public class test2 {
    HttpGet httpGet = new HttpGet("https://buff.163.com");
    Base base = new Base();


    @Test
    void proxyTest1() {

        String url = "http://www.xsdaili.com/get?orderid=197465732326122&num=1&area=%E4%B8%AD%E5%9B%BD%20%E5%B9%BF%E4%B8%9C&carrier=1&protocol=1&r_xylx=1&r_nmd=1&r_yys=1&an_ha=1&an_an=1&sp1=1&dedup=1&gj=1";
        String html = base.open(httpGet, false, new Proxy("120.83.105.45", 9999, ProxyType.HTTP));

        System.out.println(html);
    }

    @Test
    void proxyTest2() throws GetProxyException {
        Proxy proxy = ProxyPoolXs.getInstance().getProxy();
        System.out.println(proxy);
        for(int i=0 ;i<10;i++) {
            String html = base.open(httpGet, true, proxy);
            System.out.println(html);
        }
    }

    @Test
    void test(){
        HashSet set = new HashSet();
        set.add("a");
        String s = new String("a");
        System.out.println(set.contains(s));
    }
}
